package io.renren.utils;



import io.renren.core.config.ProjectConStant;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;


/**
 * 签名校验工具
 *
 * @Author: hongyuliu
 * @Date: 2019-05-14
 * @Version 1.0
 */
public class ClientSignatureUtil {

    private static final String SUFFIX = "ADP5";

    /**
     * 检查签名是否通过
     *
     * @return
     */
    public static Boolean checkSign(String id, Integer timestamp, String sign) {

        String signParam = id + ProjectConStant.OUTER_INTERFACE_APP_SERCURT + timestamp + SUFFIX;
        String signature = StringUtils.upperCase(DigestUtils.md5Hex(signParam));
        return signature.equals(sign);
    }


}
